package org.yn.car.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.yn.base.util.AjaxResult;
import org.yn.base.util.PageInfo;
import org.yn.car.doc.CarDoc;
import org.yn.car.query.CarSearchQuery;
import org.yn.car.service.ICarSearchService;

@RestController
@RequestMapping("/car/search")
public class CarSearchController {

    @Autowired
    private ICarSearchService carSearchService;

    /**
     * 总条数num  当前页要展示的数据list
     * @param query
     * @return
     */
    @PostMapping
    public AjaxResult search(@RequestBody CarSearchQuery query){
        PageInfo<CarDoc> pageInfo = carSearchService.search(query);
        return AjaxResult.success(pageInfo);
    }

}